##
## 0d0
##


d.50.0.0d0 <- d.50.0
d.100.0.0d0 <- d.100.0
d.250.0.0d0 <- d.250.0
d.500.0.0d0 <- d.500.0
d.1000.0.0d0 <- d.1000.0
d.1500.0.0d0 <- d.1500.0

d.50.1.0d0 <- d.50.1
d.100.1.0d0 <- d.100.1
d.250.1.0d0 <- d.250.1
d.500.1.0d0 <- d.500.1
d.1000.1.0d0 <- d.1000.1
d.1500.1.0d0 <- d.1500.1

d.50.2.0d0 <- d.50.2
d.100.2.0d0 <- d.100.2
d.250.2.0d0 <- d.250.2
d.500.2.0d0 <- d.500.2
d.1000.2.0d0 <- d.1000.2
d.1500.2.0d0 <- d.1500.2

d.50.3.0d0 <- d.50.3
d.100.3.0d0 <- d.100.3
d.250.3.0d0 <- d.250.3
d.500.3.0d0 <- d.500.3
d.1000.3.0d0 <- d.1000.3
d.1500.3.0d0 <- d.1500.3

d.50.4.0d0 <- d.50.4
d.100.4.0d0 <- d.100.4
d.250.4.0d0 <- d.250.4
d.500.4.0d0 <- d.500.4
d.1000.4.0d0 <- d.1000.4
d.1500.4.0d0 <- d.1500.4

d.50.45.0d0 <- d.50.45
d.100.45.0d0 <- d.100.45
d.250.45.0d0 <- d.250.45
d.500.45.0d0 <- d.500.45
d.1000.45.0d0 <- d.1000.45
d.1500.45.0d0 <- d.1500.45




##
## 1d0
##


d.50.0.1d0 <- d.50.0
d.100.0.1d0 <- d.100.0
d.250.0.1d0 <- d.250.0
d.500.0.1d0 <- d.500.0
d.1000.0.1d0 <- d.1000.0
d.1500.0.1d0 <- d.1500.0

d.50.1.1d0 <- d.50.1
d.100.1.1d0 <- d.100.1
d.250.1.1d0 <- d.250.1
d.500.1.1d0 <- d.500.1
d.1000.1.1d0 <- d.1000.1
d.1500.1.1d0 <- d.1500.1

d.50.2.1d0 <- d.50.2
d.100.2.1d0 <- d.100.2
d.250.2.1d0 <- d.250.2
d.500.2.1d0 <- d.500.2
d.1000.2.1d0 <- d.1000.2
d.1500.2.1d0 <- d.1500.2

d.50.3.1d0 <- d.50.3
d.100.3.1d0 <- d.100.3
d.250.3.1d0 <- d.250.3
d.500.3.1d0 <- d.500.3
d.1000.3.1d0 <- d.1000.3
d.1500.3.1d0 <- d.1500.3

d.50.4.1d0 <- d.50.4
d.100.4.1d0 <- d.100.4
d.250.4.1d0 <- d.250.4
d.500.4.1d0 <- d.500.4
d.1000.4.1d0 <- d.1000.4
d.1500.4.1d0 <- d.1500.4

d.50.45.1d0 <- d.50.45
d.100.45.1d0 <- d.100.45
d.250.45.1d0 <- d.250.45
d.500.45.1d0 <- d.500.45
d.1000.45.1d0 <- d.1000.45
d.1500.45.1d0 <- d.1500.45


##
## 0d1
##

d.50.0.0d1 <- d.50.0
d.100.0.0d1 <- d.100.0
d.250.0.0d1 <- d.250.0
d.500.0.0d1 <- d.500.0
d.1000.0.0d1 <- d.1000.0
d.1500.0.0d1 <- d.1500.0

d.50.1.0d1 <- d.50.1
d.100.1.0d1 <- d.100.1
d.250.1.0d1 <- d.250.1
d.500.1.0d1 <- d.500.1
d.1000.1.0d1 <- d.1000.1
d.1500.1.0d1 <- d.1500.1

d.50.2.0d1 <- d.50.2
d.100.2.0d1 <- d.100.2
d.250.2.0d1 <- d.250.2
d.500.2.0d1 <- d.500.2
d.1000.2.0d1 <- d.1000.2
d.1500.2.0d1 <- d.1500.2

d.50.3.0d1 <- d.50.3
d.100.3.0d1 <- d.100.3
d.250.3.0d1 <- d.250.3
d.500.3.0d1 <- d.500.3
d.1000.3.0d1 <- d.1000.3
d.1500.3.0d1 <- d.1500.3

d.50.4.0d1 <- d.50.4
d.100.4.0d1 <- d.100.4
d.250.4.0d1 <- d.250.4
d.500.4.0d1 <- d.500.4
d.1000.4.0d1 <- d.1000.4
d.1500.4.0d1 <- d.1500.4

d.50.45.0d1 <- d.50.45
d.100.45.0d1 <- d.100.45
d.250.45.0d1 <- d.250.45
d.500.45.0d1 <- d.500.45
d.1000.45.0d1 <- d.1000.45
d.1500.45.0d1 <- d.1500.45

##
## 1d1
##


d.50.0.1d1 <- d.50.0
d.100.0.1d1 <- d.100.0
d.250.0.1d1 <- d.250.0
d.500.0.1d1 <- d.500.0
d.1000.0.1d1 <- d.1000.0
d.1500.0.1d1 <- d.1500.0

d.50.1.1d1 <- d.50.1
d.100.1.1d1 <- d.100.1
d.250.1.1d1 <- d.250.1
d.500.1.1d1 <- d.500.1
d.1000.1.1d1 <- d.1000.1
d.1500.1.1d1 <- d.1500.1

d.50.2.1d1 <- d.50.2
d.100.2.1d1 <- d.100.2
d.250.2.1d1 <- d.250.2
d.500.2.1d1 <- d.500.2
d.1000.2.1d1 <- d.1000.2
d.1500.2.1d1 <- d.1500.2

d.50.3.1d1 <- d.50.3
d.100.3.1d1 <- d.100.3
d.250.3.1d1 <- d.250.3
d.500.3.1d1 <- d.500.3
d.1000.3.1d1 <- d.1000.3
d.1500.3.1d1 <- d.1500.3

d.50.4.1d1 <- d.50.4
d.100.4.1d1 <- d.100.4
d.250.4.1d1 <- d.250.4
d.500.4.1d1 <- d.500.4
d.1000.4.1d1 <- d.1000.4
d.1500.4.1d1 <- d.1500.4

d.50.45.1d1 <- d.50.45
d.100.45.1d1 <- d.100.45
d.250.45.1d1 <- d.250.45
d.500.45.1d1 <- d.500.45
d.1000.45.1d1 <- d.1000.45
d.1500.45.1d1 <- d.1500.45

##
## Check if Have All Three
##

par(mfrow=c(1,1))
plot (density(d.1500.1.0d0), col="red",ylim=c(0,7),xlim=c(-1,1),main="d=0") 
lines (density(d.1500.1.1d0), col="green") 
lines (density(d.1500.1.0d1), col="blue")

##
## Plot
##



par(mfrow=c(3,3), mar = c(.2,.2,.2,.2), oma= c(3,3,3,3),cex=.8)
plot (density(d.100.0.0d0), col="black",ylim=c(0,18),xlim=c(-1,1),main="",
      xlab="",ylab="", xaxt='n', yaxt ='n', lty=2,lwd=2) 
lines (density(d.250.0.0d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.0.0d0), col="black",lty=3,lwd=2)
abline(v=0,lwd=2)


plot (density(d.100.2.0d0), col="black",ylim=c(0,18),xlim=c(-1,1),main="",xlab="",ylab="",
      xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.2.0d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.2.0d0), col="black",lty=3,lwd=2)
abline(v=.2,lwd=2)

plot (density(d.100.4.0d0), col="black",ylim=c(0,18),xlim=c(-1,1),main="",xlab="",ylab="",
      xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.4.0d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.4.0d0), col="black",lty=3,lwd=2)
abline(v=.4,lwd=2)

plot (density(d.100.0.1d0), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      ylab="ARIMA (0,d,1)",xlab="",xaxt='n', yaxt ='n', lty=2,lwd=2) 
lines (density(d.250.0.1d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.0.1d0), col="black",lty=3,lwd=2)
abline(v=0,lwd=2)

plot (density(d.100.2.1d0), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      xlab="",ylab="",xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.2.1d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.2.1d0), col="black",lty=3,lwd=2)
abline(v=.2,lwd=2)

plot (density(d.100.4.1d0), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      xlab="",ylab="",xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.4.1d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.4.1d0), col="black",lty=3,lwd=2)
abline(v=.4,lwd=2)

plot (density(d.100.0.0d1), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      ylab="ARIMA(1,d,1)",xlab="",yaxt ='n',lty=2,lwd=2) 
lines (density(d.250.0.0d1), col="black",lty=1,lwd=2) 
lines (density(d.1000.0.0d1), col="black",lty=3,lwd=2)
abline(v=0,lwd=2)

plot (density(d.100.2.0d1), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      yaxt='n',xlab="",ylab="",lty=2,lwd=2) 
lines (density(d.250.2.0d1), col="black",lty=1,lwd=2) 
lines (density(d.1000.2.0d1), col="black",lty=3,lwd=2)
abline(v=.2,lwd=2)

plot (density(d.100.4.0d1), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      xlab="",ylab="",yaxt='n',lty=2,lwd=2) 
lines (density(d.250.4.0d1), col="black",lty=1,lwd=2) 
lines (density(d.1000.4.0d1), col="black",lty=3,lwd=2)
abline(v=.4,lwd=2)

mtext("d = .0                                                            d = .2                                                       d = .4", 
      side=3, line=1, cex=1.25, col="black", outer=TRUE)  

mtext("ARFIMA(0,d,1)      ARFIMA(1,d,0)     ARFIMA(0,d,0)", 
      side=2, line=1, cex=1.25, col="black", outer=TRUE)  

##
## Values
##

## ARIMA(0,d,0)

summary(cbind(d.100.0.0d0,d.250.0.0d0,d.1000.0.0d0))
summary(cbind(d.100.2.0d0,d.250.2.0d0,d.1000.2.0d0))
summary(cbind(d.100.4.0d0,d.250.4.0d0,d.1000.4.0d0))

## ARIMA(1,d,0)

summary(cbind(d.100.0.1d0,d.250.0.1d0,d.1000.0.1d0))
summary(cbind(d.100.2.1d0,d.250.2.1d0,d.1000.2.1d0))
summary(cbind(d.100.4.1d0,d.250.4.1d0,d.1000.4.1d0))

## ARIMA(0,d,1)

summary(cbind(d.100.0.0d1,d.250.0.0d1,d.1000.0.0d1))
summary(cbind(d.100.2.0d1,d.250.2.0d1,d.1000.2.0d1))
summary(cbind(d.100.4.0d1,d.250.4.0d1,d.1000.4.0d1))



##
## Revised Plot
##


par(mfrow=c(3,3), mar = c(.2,.2,.2,.2), oma= c(6,3,3,3),cex=.8)
plot (density(d.100.2.0d0), col="black",ylim=c(0,18),xlim=c(-1,1),main="",
      xlab="",ylab="", xaxt='n', yaxt ='n', lty=2,lwd=2) 
lines (density(d.250.2.0d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.2.0d0), col="black",lty=4,lwd=2)
abline(v=.2,lwd=2)


legend(x=-1.2, y=19,                       # x-y coordinates for location of the legend  
       legend=c("n = 100", "n =250", "n = 1000"),      # Legend labels  
       col=c("black", "black", "black"),   # Color of points or lines  
       lty=c(2,1,4),                    # Line type  
       lwd=c(2,2,2),                    # Line width  
       bty="n",
       seg.len=.5,
       cex=1.5,
       x.intersp=.25)             # Legend title  

plot (density(d.100.4.0d0), col="black",ylim=c(0,18),xlim=c(-1,1),main="",xlab="",ylab="",
      xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.4.0d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.4.0d0), col="black",lty=4,lwd=2)
abline(v=.4,lwd=2)

plot (density(d.100.8.0d0), col="black",ylim=c(0,18),xlim=c(-1,1),main="",xlab="",ylab="",
      xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.8.0d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.8.0d0), col="black",lty=4,lwd=2)
abline(v=-.2,lwd=2)

plot (density(d.100.2.1d0), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      ylab="ARIMA (0,d,1)",xlab="",xaxt='n', yaxt ='n', lty=2,lwd=2) 
lines (density(d.250.2.1d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.2.1d0), col="black",lty=4,lwd=2)
abline(v=.2,lwd=2)

plot (density(d.100.4.1d0), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      xlab="",ylab="",xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.4.1d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.4.1d0), col="black",lty=4,lwd=2)
abline(v=.4,lwd=2)

plot (density(d.100.8.1d0), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      xlab="",ylab="",xaxt='n',yaxt='n',lty=2,lwd=2) 
lines (density(d.250.8.1d0), col="black",lty=1,lwd=2) 
lines (density(d.1000.8.1d0), col="black",lty=4,lwd=2)
abline(v=-.2,lwd=2)

plot (density(d.100.2.0d1), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      ylab="ARIMA(1,d,1)",xlab="",yaxt ='n',lty=2,lwd=2) 
lines (density(d.250.2.0d1), col="black",lty=1,lwd=2) 
lines (density(d.1000.2.0d1), col="black",lty=4,lwd=2)
abline(v=.2,lwd=2)

plot (density(d.100.4.0d1), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      yaxt='n',xlab="",ylab="",lty=2,lwd=2) 
lines (density(d.250.4.0d1), col="black",lty=1,lwd=2) 
lines (density(d.1000.4.0d1), col="black",lty=4,lwd=2)
abline(v=.4,lwd=2)

plot (density(d.100.8.0d1), col="black",ylim=c(0,7),xlim=c(-1,1),main="",
      xlab="",ylab="",yaxt='n',lty=2,lwd=2) 
lines (density(d.250.8.0d1), col="black",lty=1,lwd=2) 
lines (density(d.1000.8.0d1), col="black",lty=4,lwd=2)
abline(v=-.2,lwd=2)

mtext("d = .2                                                            d = .4                                                       d = .8", 
      side=3, line=1, cex=1.25, col="black", outer=TRUE) 


mtext("ARFIMA(0,d,1)      ARFIMA(1,d,0)     ARFIMA(0,d,0)", 
      side=2, line=1, cex=1.25, col="black", outer=TRUE)  

mtext("Estimated Distribution of d", 
      side=1, line=3, cex=1.25, col="black", outer=TRUE)  

